﻿#region Using directives

using System;
using System.ComponentModel;
using System.Collections;
using System.Xml.Serialization;
using System.Runtime.Serialization;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;
#endregion

namespace SPL.Entities
{	
	///<summary>
	/// An object representation of the 'GPP' table. [No description found the database]	
	///</summary>
	/// <remarks>
	/// This file is generated once and will never be overwritten.
	/// </remarks>	
  [Serializable, DataObject]
	[CLSCompliant(true)]
	public partial class Gpp : GppBase
  {
    #region private data
    private bool _isLoadPreData = false;
    private double _pre7 = 0;
    private double _pre8 = 0;
    private double _pre9 = 0;
    private double _pre21 = 0;
    private double _pre30 = 0;
    private double _pre32 = 0;
    private double _pre33 = 0;
    private double _pre34 = 0;
    private double _pre39 = 0;
    private double _pre40 = 0;
    private double _pre41 = 0;
    private double _pre42 = 0;
    //private double meter

    #endregion

    #region Constructors

    ///<summary>
		/// Creates a new <see cref="Gpp"/> instance.
		///</summary>
		public Gpp():base()
    {
      this.I1InputDate = DateTime.MinValue;
      this.I2KhiAm = 0.0;
      this.I3Cond = 0.0;
      this.I4pCcp = 0.0;
      this.I6Pi0101 = 0.0;
      this.I7Fiq0401 = 0.0;
      this.I8Fiq0301 = 0.0;
      this.I9Fiq0302 = 0.0;
      this.I10Fi102ByPass = 0.0;
      this.I11Fiq26010h = 0.0;
      this.I12Fiq260124h = 0.0;
      this.I13Fiq2601Da = 0.0;
      this.I14Fiq26020h = 0.0;
      this.I15Fiq260224h = 0.0;
      this.I16Fiq2602Da = 0.0;
      this.I17Fiq26030h = 0.0;
      this.I18Fiq260324h = 0.0;
      this.I19Fiq2603Da = 0.0;
      this.I20XeBon = 0.0;
      this.I21Fiq2402 = 0.0;
      this.I22Me240h = 0.0;
      this.I23Me2424h = 0.0;
      this.I24TenMeCondBh = "";
      this.I25Me250h = 0.0;
      this.I26Me2524h = 0.0;
      this.I27Me260h = 0.0;
      this.I28Me2624h = 0.0;
      this.I29KctvNhanLpg = 0.0;
      this.I30KctvNhanCond = 0.0;
      this.I31ApSuat = 0.0;
      this.I32Me13a = 0.0;
      this.I33Me13b = 0.0;
      this.I34Fiq5801 = 0.0;
      this.I35v21aMucBon = 0.0;
      this.I36v21bMucBon = 0.0;
      this.I37v21cMucBon = 0.0;
      this.I38Tk21MucBon = 0.0;
      this.I109NoteBcn = "";
      this.I110NoteSplbh = "";
      this.I111NoteMeCondBh = "";
      this.I112NoteMeCondNcs = "";
      this.CreatedDate = DateTime.Today;
      this.InputUser = 1;
      this.Status = 1;
    }	
		
		#endregion

    #region Custom fields
    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.String I1InputDateString
    {
      get
      {
        return this.I1InputDate.ToString("dd/MM/yyyy");
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.String CreatedDateString
    {
      get
      {
        return this.CreatedDate.ToString("dd/MM/yyyy");
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F5Tong
    { 
      get
      {
        return this.I2KhiAm + 542 * this.I3Cond;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F39_V21AKhoiLuong
    {
      get
      {
        return TinhKhoiLuong1(this.I35v21aMucBon);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F40_V21BKhoiLuong
    {
      get
      {
        return TinhKhoiLuong1(this.I36v21bMucBon);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F41_V21CKhoiLuong
    {
      get
      {
        return TinhKhoiLuong1(this.I37v21cMucBon);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F42_TK21KhoiLuong
    {
      get
      {
        return TinhKhoiLuong2(this.I38Tk21MucBon);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F43_FIQ0401
    {
      get
      {
        return this.I7Fiq0401 - this.pre7;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F44_FIQ0301
    {
      get
      {
        return (this.I8Fiq0301 - this.pre8)/1000;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F45_FIQ0302
    {
      get
      {
        return (this.I9Fiq0302 - this.pre9);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F46_FI102ByPass
    {
      get
      {
        return (this.I10Fi102ByPass*24.0/1000.0);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F47_ApSuat
    {
      get
      {
        return Math.Round(this.I6Pi0101/100,2);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F48_Khi
    {
      get
      {
        return Math.Round((this.F43_FIQ0401 + this.F44_FIQ0301)/ 1000.0,3);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F49_Long
    {
      get
      {
        return this.F45_FIQ0302;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F50_TongKhiAm
    {
      get
      {
        return (F48_Khi + (F49_Long * 0.001115));
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F51_TongKhiAmVaBypass
    {
      get
      {
        return (F50_TongKhiAm + 0.0);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F52_Bupro_0h
    {
      get
      {
        return (pre39 + pre40 + pre41);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F53_Bupro_24h
    {
      get
      {
        return (F39_V21AKhoiLuong + F40_V21BKhoiLuong + F41_V21CKhoiLuong);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F54_Cond_0h
    {
      get
      {
        return (pre42);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F55_Cond_24h
    {
      get
      {
        return (F42_TK21KhoiLuong);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F56_ME25DCS
    {
      get
      {
        return Math.Round((I15Fiq260224h - I14Fiq26020h)/1000,3);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F57_ME26DCS
    {
      get
      {
        return Math.Round((I18Fiq260324h - I17Fiq26030h) / 1000, 3);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F58_ME25SITE
    {
      get
      {
        return Math.Round((I26Me2524h - I25Me250h) / 1000, 3);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F59_ME26SITE
    {
      get
      {
        return Math.Round((I28Me2624h - I27Me260h) / 1000, 3);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F60_ME24DCS
    {
      get
      {
        return Math.Round((I12Fiq260124h - I11Fiq26010h) / 1000, 3);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F61_ME24SITE
    {
      get
      {
        return Math.Round((I23Me2424h - I22Me240h) / 1000, 3);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F62_BuproVaoDODiKCDCS
    {
      get
      {
        return (F56_ME25DCS + F57_ME26DCS);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F63_BuproVaoDODiKCSITE
    {
      get
      {
        return (F58_ME25SITE + F59_ME26SITE);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F64_BuproKCNhan
    {
      get
      {
        return (I29KctvNhanLpg);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F65_BuproPhanTramCL
    {
      get
      {
        if (F62_BuproVaoDODiKCDCS != 0)
        {
          return (F64_BuproKCNhan - F62_BuproVaoDODiKCDCS) / F62_BuproVaoDODiKCDCS * 100.0;
        }
        else
        {
          return 0.0;
        }
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F66_XeBon
    {
      get
      {
        return Math.Round(I20XeBon, 2);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F67_FIQ2402
    {
      get
      {
        return (I21Fiq2402 - pre21) * 0.5;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F68_TongLPG
    {
      get
      {
        return (F62_BuproVaoDODiKCDCS + F66_XeBon);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F69_CondBHDCS
    {
      get
      {
        return F60_ME24DCS;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F70_CondBHSITE
    {
      get
      {
        return F61_ME24SITE;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F71_CondBHKCNhan
    {
      get
      {
        return pre30;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F72_CondBHPhanTramCLTheoNgay
    {
      get
      {
        if (F69_CondBHDCS != 0)
        {
          return (F71_CondBHKCNhan - F69_CondBHDCS) / F69_CondBHDCS;
        }
        else
        {
          return 0.0;
        }
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F73_KhiKhoME13A
    {
      get
      {
        return (I32Me13a - pre32) / 1000;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F74_KhiKhoME13B
    {
      get
      {
        return (I33Me13b - pre33) / 1000;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F75_KhiKhoME13
    {
      get
      {
        return (F73_KhiKhoME13A + F74_KhiKhoME13B);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F76_KhiKhoBypass
    {
      get
      {
        return F46_FI102ByPass/1000;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F77_KhiKhoME13VaBypass
    {
      get
      {
        return F75_KhiKhoME13 + F76_KhiKhoBypass;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F78_KhiKhoApSuatBarG
    {
      get
      {
        return I31ApSuat / 100.0;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F79_BuproGPPSanXuatRa
    {
      get
      {
        return F68_TongLPG + F53_Bupro_24h - F52_Bupro_0h;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F80_CondGPPSanXuatRa
    {
      get
      {
        return F69_CondBHDCS + F55_Cond_24h - F54_Cond_0h;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F81_HieuSuatThuHoiKhiKho
    {
      get
      {
        try
        {
          if (F50_TongKhiAm != 0)
          {
            return F77_KhiKhoME13VaBypass * 100.0 / F50_TongKhiAm;
          }
          else
          {
            return 0.0;
          }
          
        }
        catch
        {
          return 0.0;
        }
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F82_HieuSuatThuHoiLPG
    {
      get
      {
        try
        {
          if (F50_TongKhiAm != 0)
          {
            return F79_BuproGPPSanXuatRa / F50_TongKhiAm;
          }
          else
          {
            return 0.0;
          }
          
        }
        catch
        {
          return 0.0;
        }        
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F83_HieuSuatThuHoiCond
    {
      get
      {
        try
        {
          if (F50_TongKhiAm != 0)
          {
            return F80_CondGPPSanXuatRa / F50_TongKhiAm;
          }
          else
          {
            return 0.0;
          }          
        }
        catch
        {
          return 0.0;
        }
      }
    }

    /// <summary>
    /// 
    /// </summary>
    [DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    [DataObjectField(false, false, false)]
    public virtual System.Double F84_FuelFIQ5801
    {
      get
      {
        return I34Fiq5801 - pre34;
      }
    }

    /// <summary>
    /// 
    /// </summary>
    //[DescriptionAttribute(""), System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
    //[DataObjectField(false, false, false)]
    //public virtual System.Double F84_FuelFIQ5801
    //{
    //  get
    //  {
    //    return I34Fiq5801 - pre34;
    //  }

    //  set
    //  {

    //  }
    //}

    #region pre data
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre7
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre7;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre8
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre8;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre9
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre9;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre21
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre21;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre30
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre30;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre32
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre32;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre33
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre33;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre34
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre34;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre39
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre39;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre40
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre40;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre41
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre41;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public virtual double pre42
    {
      get
      {
        if (!_isLoadPreData)
        {
          LoadPreData();
          _isLoadPreData = true;
        }
        return _pre42;
      }
    }
    #endregion

    #endregion

    #region Helper method

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    private void LoadPreData()
    {
      TimeSpan oneDay = new TimeSpan(1, 0, 0, 0, 0);
      DateTime yesterday = this.I1InputDate.Subtract(oneDay);

      string queryString = "SELECT * FROM GPP WHERE I1InputDate='" + yesterday.ToShortDateString() + "' AND Hid IS NULL";
      using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SPL.Data.ConnectionString"].ConnectionString))
      {
        SqlCommand command = new SqlCommand(queryString, connection);
        connection.Open();
        SqlDataReader reader = command.ExecuteReader();
        try
        {
          if (reader.Read())
          {
            _pre7 =  (double)reader["I7Fiq0401"];
            _pre8 =  (double)reader["I8Fiq0301"];
            _pre9 =  (double)reader["I9Fiq0302"];
            _pre21 = (double)reader["I21Fiq2402"];
            _pre30 = (double)reader["I30KctvNhanCond"];
            _pre32 = (double)reader["I32Me13a"];
            _pre33 = (double)reader["I33Me13b"];
            _pre34 = (double)reader["I34Fiq5801"];
            _pre39 = TinhKhoiLuong1((double)reader["I35v21aMucBon"]);
            _pre40 = TinhKhoiLuong1((double)reader["I36v21bMucBon"]);
            _pre41 = TinhKhoiLuong1((double)reader["I37v21cMucBon"]);
            _pre42 = TinhKhoiLuong2((double)reader["I38Tk21MucBon"]);
          }
          else
          {
            _pre7 = 0;
            _pre8 = 0;
            _pre9 = 0;
            _pre21 = 0;
            _pre30 = 0;
            _pre32 = 0;
            _pre33 = 0;
            _pre34 = 0;
            _pre39 = 0;
            _pre40 = 0;
            _pre41 = 0;
            _pre42 = 0;
          }
        }
        catch
        {
          _pre7 = 0;
          _pre8 = 0;
          _pre9 = 0;
          _pre21 = 0;
          _pre30 = 0;
          _pre32 = 0;
          _pre33 = 0;
          _pre34 = 0;
          _pre39 = 0;
          _pre40 = 0;
          _pre41 = 0;
          _pre42 = 0;
        }
        finally
        {
          // Always call Close when done reading.
          reader.Close();
        }
      }
    }
    private double TinhKhoiLuong1(double muc_bon)
    {
      try
      {
        double temp = (1.675 - 3.35 * muc_bon / 100) / 1.675;
        return (Math.Round(54.61 * 0.541 * (1.675 * 1.675 / 2 * ((Math.Acos(temp) * 2) - (Math.Sin(Math.Acos(temp) * 2)))), 3));
      }
      catch
      {
        return 0;
      }

    }
    private double TinhKhoiLuong2(double muc_bon)
    {
      try
      {
        return (Math.Round((15.6 / 100 * muc_bon) * 13 * 13 / 4 * Math.PI * 0.666, 3));
      }
      catch
      {
        return 0;
      }
    }
    #endregion


  }
}
